package com.tuanzi.loan.business.service.family.impl;

import com.tuanzi.loan.business.entity.family.LoanNewCreditCardProgress;
import com.tuanzi.loan.business.repository.family.LoanNewCreditCardProgressRepository;
import com.tuanzi.loan.business.service.family.LoanNewCreditCardProgressService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.repository.JPAAuditRepository;
import com.tuanzi.loan.core.service.BaseAuditServiceImpl;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.family.LoanNewCreditCardProgressRequest;
import com.tuanzi.loan.vo.response.family.LoanNewCreditCardProgressResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * User: liangZongXi
 * Create time: 10:46 2018/9/20
 * Description:
 */
@Debug
@Service
@Transactional
@Retryable(value = {RetryException.class})
public class LoanNewCreditCardProgressServiceImpl extends BaseAuditServiceImpl<LoanNewCreditCardProgress, Integer> implements LoanNewCreditCardProgressService {

    @Autowired
    private LoanNewCreditCardProgressRepository loanNewCreditCardProgressRepository;

    @Override
    public Page<LoanNewCreditCardProgressResponse> list(PageSearcher<LoanNewCreditCardProgressRequest> pageSearcher) {
        return loanNewCreditCardProgressRepository.list(pageSearcher.getSearchCondition(),pageSearcher.getPageable());
    }

    @Override
    public List<LoanNewCreditCardProgress> findAllByStatus(Integer status) {
        return loanNewCreditCardProgressRepository.findAllByStatus(status);
    }

    @Override
    public LoanNewCreditCardProgress findByBankName(String bankName) {
        return loanNewCreditCardProgressRepository.findByBankName(bankName);
    }

    @Override
    protected JPAAuditRepository<LoanNewCreditCardProgress, Integer> getRepository() {
        return loanNewCreditCardProgressRepository;
    }
}
